package day11.relect;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Test03 {

    @MyTest2
    public  void test01(){
        System.out.println("=====test01=====");
    }

    public  void test02(){
        System.out.println("=====test02=====");
    }

    @MyTest2
    public  void test03(){
        System.out.println("=====test03=====");
    }

    public static void main(String[] args) throws InvocationTargetException, IllegalAccessException {
        Test03 t = new Test03();
        Class c=Test03.class;
        Method[] methods = c.getMethods();
        for (Method m : methods) {
            if(m.isAnnotationPresent(MyTest2.class)){
                m.invoke(t);
            }
        }
    }
}
//@Target(ElementType.METHOD)//作用在method方法上
//@Retention(RetentionPolicy.RUNTIME)//运行时一直存在
//@interface MyTest{
//}